package Visual;

import Logica.CargaDescarga;
import Logica.Ingreso;
import Logica.Plantacion;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;

public class frmAltaIngreso extends javax.swing.JDialog {
    private Principal unaPrincipal = new Principal();
    private DefaultListModel listaCargaDescarga = new DefaultListModel();
    private ControladoraVisual miControladora = new ControladoraVisual();
    frmAltaPlantacion unaPlantacion;
    boolean habilitado = true;
    private DefaultListModel listaPlantaciones = new DefaultListModel();
    private Date fechaP;
    
    public frmAltaIngreso(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        this.lstCargaDescarga.setModel(listaCargaDescarga);
        setTitle("Alta Plantación");
        initComponents();
        this.lstPlantaciones.setModel(listaPlantaciones);
        this.setLocationRelativeTo(unaPrincipal);
        
    }
    
    
    public frmAltaIngreso(java.awt.Frame parent, boolean modal, boolean altaCargaDescarga) {
        super(parent, modal);
        setTitle("Alta Ingreso");
        initComponents();
        if (!altaCargaDescarga) //No se debe permitir un bucle infinito de instanciación de ventanas
            this.btnAgregarDescarga.setEnabled(false);
        this.setLocationRelativeTo(unaPrincipal);
    }
    
    public frmAltaIngreso(java.awt.Frame parent, boolean modal, boolean habilitar, frmAltaPlantacion unaVentana) {
        super(parent, modal);
        setTitle("Alta Parcela");
        initComponents();
        this.lstPlantaciones.setEnabled(habilitar);
        this.setLocationRelativeTo(unaPrincipal);
        this.habilitado = habilitar;
        this.unaPlantacion = unaPlantacion;
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        cmbHora = new javax.swing.JComboBox();
        lblFecha = new javax.swing.JLabel();
        lblHora = new javax.swing.JLabel();
        cmbMinutos = new javax.swing.JComboBox();
        lblTipoIngreso = new javax.swing.JLabel();
        rbtnLenia = new javax.swing.JRadioButton();
        rbtnYerbaVerde = new javax.swing.JRadioButton();
        rbtnCanchada = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        lblDescarga = new javax.swing.JLabel();
        btnAgregarPlantacion = new javax.swing.JButton();
        btnAgregarDescarga = new javax.swing.JButton();
        chkSeca = new javax.swing.JCheckBox();
        chkVerde = new javax.swing.JCheckBox();
        btnAlta = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        cmbDia = new javax.swing.JComboBox();
        cmbMes = new javax.swing.JComboBox();
        cmbAnio = new javax.swing.JComboBox();
        btnOKFechaHora = new javax.swing.JButton();
        jlbPlantacion = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        lstPlantaciones = new javax.swing.JList();
        cmbOrigen = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        lstCargaDescarga = new javax.swing.JList();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        cmbHora.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" }));

        lblFecha.setText("Fecha");

        lblHora.setText("Hora");

        cmbMinutos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60" }));

        lblTipoIngreso.setText("Tipo Ingreso");

        rbtnLenia.setText("Leña");
        rbtnLenia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnLeniaActionPerformed(evt);
            }
        });

        rbtnYerbaVerde.setText("Yerba Verde");
        rbtnYerbaVerde.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnYerbaVerdeActionPerformed(evt);
            }
        });

        rbtnCanchada.setText("Yerba Canchada");
        rbtnCanchada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnCanchadaActionPerformed(evt);
            }
        });

        jLabel4.setText("Plantacion:");

        lblDescarga.setText("Descarga");

        btnAgregarPlantacion.setText("Agregar Plantación");
        btnAgregarPlantacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarPlantacionActionPerformed(evt);
            }
        });

        btnAgregarDescarga.setText("Agregar Descarga");
        btnAgregarDescarga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarDescargaActionPerformed(evt);
            }
        });

        chkSeca.setText("Seca");
        chkSeca.setEnabled(false);
        chkSeca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkSecaActionPerformed(evt);
            }
        });

        chkVerde.setText("Verde");
        chkVerde.setEnabled(false);
        chkVerde.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkVerdeActionPerformed(evt);
            }
        });

        btnAlta.setText("Alta");
        btnAlta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAltaActionPerformed(evt);
            }
        });

        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        cmbDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        cmbMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));

        cmbAnio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2013", "2014", "2015", "2016" }));

        btnOKFechaHora.setText("OK");
        btnOKFechaHora.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOKFechaHoraActionPerformed(evt);
            }
        });

        jScrollPane1.setViewportView(lstPlantaciones);

        cmbOrigen.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Propio", "Tercero", "Alquilado" }));

        jLabel1.setText("Origen");

        jScrollPane2.setViewportView(lstCargaDescarga);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblHora)
                                .addGap(18, 18, 18)
                                .addComponent(cmbHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblFecha)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cmbDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cmbMinutos, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cmbMes, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cmbAnio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(99, 99, 99))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cmbOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(54, 54, 54)
                                .addComponent(btnOKFechaHora))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(lblDescarga)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(6, 6, 6))
                                .addComponent(btnAgregarDescarga))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblTipoIngreso)
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(rbtnCanchada)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(rbtnLenia)
                                            .addComponent(rbtnYerbaVerde))
                                        .addGap(40, 40, 40)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(chkVerde)
                                            .addComponent(chkSeca))))))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(211, 211, 211)
                        .addComponent(jlbPlantacion, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(75, 75, 75)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnAgregarPlantacion)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(107, 107, 107))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(314, 314, 314)
                        .addComponent(jLabel4))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(153, 153, 153)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btnAlta)
                                .addGap(169, 169, 169))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGap(145, 145, 145)
                                .addComponent(btnCancelar)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblFecha)
                            .addComponent(cmbDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cmbMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cmbAnio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addGap(4, 4, 4)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnAgregarPlantacion))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblHora)
                                    .addComponent(cmbHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cmbMinutos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(cmbOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1)
                                    .addComponent(btnOKFechaHora))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblTipoIngreso)
                                    .addComponent(rbtnLenia)
                                    .addComponent(chkSeca))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(rbtnYerbaVerde)
                                    .addComponent(chkVerde))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(rbtnCanchada)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblDescarga)
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnAgregarDescarga)))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnAlta)
                            .addComponent(btnCancelar)))
                    .addComponent(jlbPlantacion))
                .addContainerGap(58, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
        dispose();
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void btnAgregarDescargaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarDescargaActionPerformed
        frmAltaCargaDescarga unaVentana = new frmAltaCargaDescarga(unaPrincipal,true, false,this);
        unaVentana.setVisible(true);
    }//GEN-LAST:event_btnAgregarDescargaActionPerformed

    private void btnAgregarPlantacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarPlantacionActionPerformed
        frmAltaPlantacion unaVentana = new frmAltaPlantacion(unaPrincipal,true,false,this);
        unaVentana.setVisible(true);
    }//GEN-LAST:event_btnAgregarPlantacionActionPerformed

    private void btnOKFechaHoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKFechaHoraActionPerformed
        // TODO add your handling code here:
        try{
            String dia = (String) cmbDia.getSelectedItem();
            String mes = (String) cmbMes.getSelectedItem();
            String anio = (String) cmbAnio.getSelectedItem();
            String laFecha = dia + "/" + mes + "/" + anio;
            SimpleDateFormat formatoDeFecha = new SimpleDateFormat("dd/MM/yyyy");
            fechaP = formatoDeFecha.parse(laFecha);
        }catch(ParseException ex){
            JOptionPane.showMessageDialog(this, "Error de parseo" + ex.getMessage(), "Lo sentimos, algo ha salido mal", JOptionPane.WARNING_MESSAGE);
       }
        
            String hora = (String) cmbHora.getSelectedItem();
            String min = (String) cmbMinutos.getSelectedItem();
       
            List<Plantacion> plantaciones = miControladora.obtenerListPlantaciones();
            for(Plantacion unaPlantacion:plantaciones){
                this.listaPlantaciones.addElement(unaPlantacion);
            }
        
                
            
            
    }//GEN-LAST:event_btnOKFechaHoraActionPerformed

    private void btnAltaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAltaActionPerformed
        String tipoIngreso;
        try{
            String dia = (String) cmbDia.getSelectedItem();
            String mes = (String) cmbMes.getSelectedItem();
            String anio = (String) cmbAnio.getSelectedItem();
            String laFecha = dia + "/" + mes + "/" + anio;
            SimpleDateFormat formatoDeFecha = new SimpleDateFormat("dd/MM/yyyy");
            fechaP = formatoDeFecha.parse(laFecha);
        }catch(ParseException ex){
            JOptionPane.showMessageDialog(this, "Error de parseo" + ex.getMessage(), "Lo sentimos, algo ha salido mal", JOptionPane.INFORMATION_MESSAGE);
       }
        
            String hora = (String) cmbHora.getSelectedItem();
            String min = (String) cmbMinutos.getSelectedItem();
            String horayMinuto = (hora + ":" + min);
                    
            String origen = (String) cmbOrigen.getSelectedItem();
            if(rbtnLenia.isSelected()){
                if(chkSeca.isSelected()){
                        tipoIngreso = chkSeca.getText();
                }else{
                    tipoIngreso = chkVerde.getText();
                }
            }else if(rbtnCanchada.isSelected()){
                tipoIngreso = rbtnCanchada.getText();
            }else{
                tipoIngreso = rbtnYerbaVerde.getText();}
             CargaDescarga unaCargaDescarga = (CargaDescarga) lstCargaDescarga.getSelectedValue();
             if(habilitado){ 
                Plantacion unaPlan = (Plantacion) lstPlantaciones.getSelectedValue();
                Ingreso unIngreso = miControladora.altaIngreso(fechaP,horayMinuto,tipoIngreso,origen,unaPlan,unaCargaDescarga);
             }else{
                Ingreso unIngreso = miControladora.altaIngreso(fechaP,horayMinuto,tipoIngreso,origen,unaCargaDescarga); 
                unaPlantacion.ObtenerIngreso (unIngreso);
        
            
        }
    }//GEN-LAST:event_btnAltaActionPerformed
    
    private void rbtnLeniaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnLeniaActionPerformed
        // TODO add your handling code here:
        rbtnCanchada.setEnabled(false);
        rbtnYerbaVerde.setEnabled(false);
        chkSeca.setEnabled(true);
        chkVerde.setEnabled(true);
    }//GEN-LAST:event_rbtnLeniaActionPerformed

    private void rbtnYerbaVerdeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnYerbaVerdeActionPerformed
        // TODO add your handling code here:
        rbtnLenia.setEnabled(false);
        rbtnCanchada.setEnabled(false);
    }//GEN-LAST:event_rbtnYerbaVerdeActionPerformed

    private void rbtnCanchadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnCanchadaActionPerformed
        // TODO add your handling code here:
        rbtnLenia.setEnabled(false);
        rbtnYerbaVerde.setEnabled(false);
    }//GEN-LAST:event_rbtnCanchadaActionPerformed

    private void chkSecaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSecaActionPerformed
        // TODO add your handling code here:
        chkVerde.setEnabled(false);
    }//GEN-LAST:event_chkSecaActionPerformed

    private void chkVerdeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkVerdeActionPerformed
        // TODO add your handling code here:
        chkSeca.setEnabled(false);
    }//GEN-LAST:event_chkVerdeActionPerformed
   
    public void obtenerCargaDescarga(CargaDescarga unaCargaDescarga){
       this.listaCargaDescarga.addElement(unaCargaDescarga);
    }
    /*public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        /*try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmAltaIngreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmAltaIngreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmAltaIngreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmAltaIngreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }*/
        //</editor-fold>

        /* Create and display the dialog */
        /*java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                frmAltaIngreso dialog = new frmAltaIngreso(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }*/
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAgregarDescarga;
    private javax.swing.JButton btnAgregarPlantacion;
    private javax.swing.JButton btnAlta;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnOKFechaHora;
    private javax.swing.JCheckBox chkSeca;
    private javax.swing.JCheckBox chkVerde;
    private javax.swing.JComboBox cmbAnio;
    private javax.swing.JComboBox cmbDia;
    private javax.swing.JComboBox cmbHora;
    private javax.swing.JComboBox cmbMes;
    private javax.swing.JComboBox cmbMinutos;
    private javax.swing.JComboBox cmbOrigen;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel jlbPlantacion;
    private javax.swing.JLabel lblDescarga;
    private javax.swing.JLabel lblFecha;
    private javax.swing.JLabel lblHora;
    private javax.swing.JLabel lblTipoIngreso;
    private javax.swing.JList lstCargaDescarga;
    private javax.swing.JList lstPlantaciones;
    private javax.swing.JRadioButton rbtnCanchada;
    private javax.swing.JRadioButton rbtnLenia;
    private javax.swing.JRadioButton rbtnYerbaVerde;
    // End of variables declaration//GEN-END:variables

    void btnAgregarCargaDescarga(CargaDescarga unaCargaDescarga) {
        listaCargaDescarga.addElement(unaCargaDescarga); //To change body of generated methods, choose Tools | Templates.
    }

    void btnAgregarPlantacion(Plantacion unaPlantacion) {
        listaPlantaciones.addElement(unaPlantacion); //To change body of generated methods, choose Tools | Templates.
    }

}